const { defineConfig } = require("@vue/cli-service");
// 1.1基于 vue-cli 的项目，在 vue.config.js 文件中配置插件(vant3 按需配置插件 安装vant包和安装插件之后，第三步在这里面配置文件)
const { VantResolver } = require("unplugin-vue-components/resolvers");
const ComponentsPlugin = require("unplugin-vue-components/webpack");
// 2.1导入当前路径
const path = require("path");

module.exports = defineConfig({
  transpileDependencies: true,
  // 1.2配置vant3插件
  configureWebpack: {
    plugins: [
      ComponentsPlugin({
        resolvers: [VantResolver()],
      }),
    ],
    //
    devServer: {
      // port: 8080, // 服务器端口
      proxy: {
        "/lanqb": {
          target: "https://m.lanqb.com",
          changeOrigin: true,
          pathRewrite: {
            "^/lanqb": "",
          },
        },
      },
    },
    // 2.2  使用前先导入const path = require("path");
    resolve: {
      alias: {
        //__dirname 代表当前文件的路径
        "@assets": path.resolve(__dirname, "src/assets"),
        "@utils": path.resolve(__dirname, "src/utils"),
      },
    },
  },
});
